﻿<UserControl x:Class="SilverlightValidation.Views.UserView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Background="White">

        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="50" />
            <RowDefinition Height="120" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="30" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Username:" />

        <TextBox x:Name="tbUsername"
                 Grid.Row="1"
                 Grid.Column="2"
                 Style="{StaticResource TextBoxStyle}"
                 Text="{Binding Username,
                                Mode=TwoWay,
                                ValidatesOnNotifyDataErrors=True,
                                NotifyOnValidationError=True}" />

        <sdk:DescriptionViewer Grid.Row="1"
                               Grid.Column="3"
                               Width="20"
                               Description="Required" />

        <TextBlock Grid.Row="2"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Password:" />

        <PasswordBox x:Name="tbPassword"
                     Grid.Row="2"
                     Grid.Column="2"
                     Password="{Binding Password,
                                        Mode=TwoWay,
                                        ValidatesOnNotifyDataErrors=True,
                                        NotifyOnValidationError=True}"
                     Style="{StaticResource PasswordBoxStyle}" />

        <sdk:DescriptionViewer Grid.Row="2"
                               Grid.Column="3"
                               Width="20"
                               Description="Required" />

        <TextBlock Grid.Row="3"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Email:" />

        <TextBox x:Name="tbEmail"
                 Grid.Row="3"
                 Grid.Column="2"
                 Style="{StaticResource TextBoxStyle}"
                 Text="{Binding Email,
                                Mode=TwoWay,
                                ValidatesOnNotifyDataErrors=True,
                                NotifyOnValidationError=True}" />

        <sdk:DescriptionViewer Grid.Row="3"
                               Grid.Column="3"
                               Width="20"
                               Description="Required" />

        <TextBlock Grid.Row="4"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Date of Birth:" />

        <sdk:DatePicker x:Name="dpDateOfBirth"
                        Grid.Row="4"
                        Grid.Column="2"
                        KeyDown="DatePicker_KeyDown"
                        SelectedDate="{Binding DateOfBirth,
                                               Mode=TwoWay,
                                               ValidatesOnNotifyDataErrors=True,
                                               NotifyOnValidationError=True}"
                        Style="{StaticResource DatePickerStyle}" />
        <sdk:DescriptionViewer Grid.Row="4"
                               Grid.Column="3"
                               Width="20"
                               Description="Required" />

        <TextBlock Grid.Row="5"
                   Grid.Column="1"
                   Style="{StaticResource LabelStyle}"
                   Text="Description:" />

        <TextBox x:Name="tbDescription"
                 Grid.Row="5"
                 Grid.Column="2"
                 Style="{StaticResource TextBoxStyle}"
                 Text="{Binding DescriptionWithATypeo}" />

        <StackPanel Grid.Row="6"
                    Grid.Column="2"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button x:Name="btnThrowException"
                    Width="120"
                    Click="btnThrowException_OnClick"
                    Content="Throw Exception"
                    Style="{StaticResource ButtonStyle}" />
        </StackPanel>

        <sdk:ValidationSummary Grid.Row="7"
                               Grid.Column="1"
                               Grid.ColumnSpan="2"
                               Style="{StaticResource ValidationSummaryStyle}" />

    </Grid>
</UserControl>